<#assign ctx=request.contextPath />
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
  <title>分配探漏任务</title>
  <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css" />
  <link rel="stylesheet" href="${ctx}/css.css">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
  <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.10&key=9b29a6048cb5ef7de6f503dc38e32d0c&plugin=AMap.ToolBar"></script>
</head>

<body>
<div class="top">
  <a href="${ctx}/hello" class="backtrack"><img src="${ctx}/0.png"></a>
  <a href="javascript:history.back();" class="return"><img src="${ctx}/12.png"></a>
  <div class="box">
    分配探漏任务
  </div>
</div>
<div class="empty"></div>

<form id="form1" class="form1" action="${ctx}/lossMng/completeTask/${task.id}">
<table class="top_box">
 <h5>流程实例</h5>
  <tr hidden>
    <td class="lo_3">实例ID</td>
    <td class="lo_4">${pinst.id}</td>
  </tr>
  <tr class="lo_7">
    <td class="lo_3">实例名称</td>
    <td class="lo_4">${pinst.name!""}</td>
  </tr>
  <tr>
    <td class="lo_3">发起人</td>
    <td class="lo_4">${pinst.initiator!""}</td>
  </tr>
  <tr>
    <td class="lo_3">开始日期</td>
    <td class="lo_4">${pinst.startDate?datetime!""}</td>
  </tr>
  <tr>
    <td class="lo_3">状态</td>
    <td class="lo_4">${pinst.status}</td>
  </tr>
</table>
<br/>

<h5>子任务</h5>
<table class="list_box">

  <tr class="lo_7">
    <td class="lo_3">工单ID</td>
    <td class="lo_3">${ticket.ticketId}</td>
  </tr>
  <tr>
    <td class="lo_3">DMA-ID</td>
    <td class="lo_3">${ticket.dmaId}</td>
  </tr>
  <tr>
    <td class="lo_3">DMA名称</td>
    <td class="lo_3">${ticket.dmaName}</td>
  </tr>
  <tr>
    <td class="lo_3">DMA分区位置</td>
    <td class="lo_3">
      <input type="hidden" id="findLoc"  value="${ticket.dmaLoc!""}" >
      <div id="map1" class="map"></div>

      <script type="text/javascript">
        var c=document.getElementById("findLoc").value;
      
        function a() {
          var firstLeftIndex = c.lastIndexOf('(');
          var lastRightIndex = c.indexOf(')');
          // 去掉首尾括号
          var str = c.substring(firstLeftIndex + 1, lastRightIndex);
          var arr = str.split(" ");
          return arr;
        };

        var attrs = a();
        var lng = parseFloat(attrs[1]);
        var lat = parseFloat(attrs[0]);
        // 中国地区，总是：经度 > 纬度
        if (lng < lat) {
          var tmp = lng;
          lng = lat;
          lat = tmp;
        }
        var map = new AMap.Map("map1", {
          zoom: 18,
          center:[lng, lat]
        });
        var marker = new AMap.Marker({
          map:map,
          position:[lng,lat],
          label: {
            offset: new AMap.Pixel(-40, 35),//修改label相对于maker的位置
            content: "点击DMA图标打开高德地图"
          }
        })
        marker.on('click',function(e){
          marker.markOnAMAP({
            name:'DMA分区位置',
            position:marker.getPosition()
          })
        })
        
  </script>
    </td>
  </tr>
  <tr>
    <td class="lo_3">工单日期</td>
    <td class="lo_3">${(ticket.startDate?date)!""}</td>
  </tr>
  <tr>
    <td class="lo_3">工单起始漏损(m³/h)</td>
    <td class="lo_3">${(ticket.startLoss?string("0.0"))!""}</td>
  </tr>
  <tr>
    <td class="lo_3">工单最大漏损(m³/h)</td>
    <td class="lo_3">${(ticket.maxLoss?string("0.0"))!""}</td>
  </tr>
  <tr>
    <td class="lo_3">工单最大漏损日期</td>
    <td class="lo_3">${(ticket.maxDate?date)!""}</td>
  </tr>
  <tr>
    <td class="lo_3 lo_5"><label>终止原因(如果不需要探漏)</label></td>
    <td class="lo_4 lo_5" colspan="2"><textarea title="终止原因" name="cancelReason" class="flow lo_5"></textarea></td>
  </tr>

</table>
<br/>

  <select name="finderId" class="zone_2">
    <#list finderList as user>
    <option value="${user.id}">${user.name} (${user.id})</option>
  </#list>
  </select>

  <div class="select"><input type="checkbox" name="findType" checked="checked"> <b>需要探漏</b></div>
  <input type="submit" value=" 分配探漏任务 "class="affirm">

</form>

</body>
</html>
